package service;

import mapper.SysIpconfigMapper;
import model.SysIpconfig;
import utils.MybatisUtils;

import java.util.HashMap;
import java.util.Map;

/**
 * 查询所有通道 设备
 *
 * @author 修唯xiuwei
 * @Email 524710549@qq.com
 **/
public class SysIpconfigService {

	private static class LazyHolder {
		private static final SysIpconfigService INSTANCE = new SysIpconfigService();
	}

	private SysIpconfigService() {
	}

	public static final SysIpconfigService getInstance() {
		return LazyHolder.INSTANCE;
	}


	private SysIpconfigMapper disconnectedMapper = MybatisUtils.getSqlSession().getMapper(SysIpconfigMapper.class);

	public Map<String, SysIpconfig> sysIpconfigMap;


	public Map<String, SysIpconfig> getSysIpconfigMap() {
		if (this.sysIpconfigMap == null) {
			this.sysIpconfigMap = new HashMap<>();
			for (SysIpconfig d : disconnectedMapper.getAllSysIpconfig()) {
				this.sysIpconfigMap.put(d.getId(), d);
			}
		}
		return this.sysIpconfigMap;
	}


}
